<?php
/*
 * Created on Feb 11, 2011
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

include_once("../configure/admin.config.inc.php");	//--> admin global var
include_once("db.inc.php");							//--> db global var
include_once("Common.php");							//--> Common

$objCommon	= new Common();			//--> Common

if(isset($_POST['Submit'])){
	$id                = $_POST['id'];
	$name              = addslashes($_POST['name']);       
	$headline          = addslashes($_POST['headline']);       
	$URL               = $_POST['URL'];       
	$type              = $_POST['type'];       
	$CSPhone           = $_POST['CSPhone'];       
	$CSEmail           = $_POST['CSEmail'];       
	$certificate       = addslashes($_POST['certificate']);       
	$descript          = addslashes($_POST['descript']);       
	$shippingPolicy    = addslashes($_POST['shippingPolicy']);       
	$taxPolicy         = addslashes($_POST['taxPolicy']);       
	$paymentPolicy     = addslashes($_POST['paymentPolicy']);       
	$returnPolicy      = addslashes($_POST['returnPolicy']);       
	$privacyPolicy     = addslashes($_POST['privacyPolicy']);       
	$shippingPolicyURL = addslashes($_POST['shippingPolicyURL']);       
	$taxPolicyURL      = addslashes($_POST['taxPolicyURL']);       
	$paymentPolicyURL  = addslashes($_POST['paymentPolicyURL']);       
	$returnPolicyURL   = addslashes($_POST['returnPolicyURL']);       
	$certificateURL    = addslashes($_POST['certificateURL']);       
	$displayURL        = $_POST['displayURL'];       
	$StoreReview       = addslashes($_POST['StoreReview']);       
	$deactiveReason    = $_POST['deactiveReason'];       
	$createdTime       = $_POST['createdTime'];       
	$modifiedTime      = $_POST['modifiedTime'];       
	$authorized        = $_POST['authorized'];       
	$rating            = $_POST['rating'];       
	$sitemapPriority   = $_POST['sitemapPriority'];       
	$isAdSenseCode     = $_POST['isAdSenseCode'];       
	$onlineCouponCount = $_POST['onlineCouponCount'];       
	$reviewCount       = $_POST['reviewCount'];       
	
	$status 			= $_POST['status'];       
	$isFeatured 		= $_POST['isFeatured']; 
	
	$sql = "INSERT INTO merchant set id=$id, name='$name', headline='$headline',descript='$descript',URL='$URL'," .
			"type='$type',CSPhone='$CSPhone',CSEmail='$CSEmail',certificate='$certificate',shippingPolicy='$shippingPolicy',taxPolicy='$taxPolicy'," .
			"createdTime='$createdTime',paymentPolicy='$paymentPolicy',returnPolicy='$returnPolicy',privacyPolicy='$privacyPolicy',status='$status'," .
			"shippingPolicyURL='$shippingPolicyURL',taxPolicyURL='$taxPolicyURL',paymentPolicyURL='$paymentPolicyURL',returnPolicyURL='$returnPolicyURL',certificateURL='$certificateURL'," .
			"displayURL='$displayURL',storeReview='$StoreReview',deactiveReason='$deactiveReason',authorized='$authorized',rating='$rating'," .
			"sitemapPriority='$sitemapPriority',isFeatured='$isFeatured',isAdSenseCode='$isAdSenseCode',r_onlineCouponCount='$onlineCouponCount',r_reviewCount='$reviewCount'," .
			"modifiedTime='$modifiedTime' ON DUPLICATE KEY UPDATE id = VALUES(id), authorized = VALUES(authorized), status = VALUES(status)";
	
	$isSuccess = $objCommon->update(DB_TAG_COUPON, $sql);
	if($isSuccess){
		$error_message = 'add successfully.';
	}else 
		$error_message = 'add failure.';
}else{
	$error_message = 'invalid submit.';
}

echo $error_message;

?>
